import { LocaleType, type IWorkbookData } from '@univerjs/presets'
import type { IReq } from './type'
import type { IFormDataIntervalDto } from '@/components/sheets/CmpSheets'

// https://docs.univer.ai/zh-CN/guides/sheets/getting-started/workbook-data#完整示例
export const workbookData: IWorkbookData = {
  id: 'gyI0JO',
  sheetOrder: ['RSfWjJFv4opmE1JaiRj80'],
  name: '',
  appVersion: '0.5.0',
  locale: LocaleType.ZH_CN,
  styles: {},
  sheets: {
    sheet1: {
      name: '温度记录表', // sheet名称
      // 行列数
      rowCount: 50,
      columnCount: 10,

      // 默认的单元格数据(以 snapshot 的形式存放)
      cellData: {
        // cellData[rowIndex][colIndex] = { s: styleId, v: cellValue, t: valueType }
        '0': {
          '0': { v: '日期', t: 1 },
          '1': { v: '${date}', t: 1 },
        },
        '1': {
          '0': { v: '温度', t: 1 },
          '1': { v: '', t: 1 },
        },
        '2': {
          '0': { v: '上 午 7:00 - 9:00', t: 1 },
          '1': { v: '冷藏室${sen[0].10°}', t: 1 },
        },
        '3': {
          '0': { v: '温度监测记录(签字及时间)', t: 1 },
          '1': { v: '${temperature}', t: 1 },
        },
        '4': {
          '0': { v: '下 午 15:00 - 17:00', t: 1 },
          '1': { v: '冷藏室${sen[1].10°}', t: 1 },
        },
        '5': {
          '0': { v: '温度监测记录(签字及时间)', t: 1 },
          '1': { v: '${name}', t: 1 },
        },
        '6': {
          '0': { v: '清洁除霜记录 (签字)', t: 1 },
        },
      },

      // 一些合并信息 merges: [ {startRow, endRow, startColumn, endColumn}, ... ]
      merges: [
        // 第1行的两格 (A1~B1)
        { startRow: 0, endRow: 0, startColumn: 0, endColumn: 1 },
        // 第2行的两格 (A2~B2)
        { startRow: 1, endRow: 1, startColumn: 0, endColumn: 1 },
        // 第7行 (A7~B7) 全行合并
        { startRow: 6, endRow: 6, startColumn: 0, endColumn: 1 },
      ],

      // 列宽、样式等可以写在这里 (也可以在渲染时用API做)
      styles: {},
    },
  },
  resources: [
    { name: 'SHEET_RANGE_PROTECTION_PLUGIN', data: '' },
    { name: 'SHEET_AuthzIoMockService_PLUGIN', data: '{}' },
    { name: 'SHEET_WORKSHEET_PROTECTION_PLUGIN', data: '{}' },
    { name: 'SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN', data: '{}' },
    { name: 'SHEET_DEFINED_NAME_PLUGIN', data: '{}' },
    { name: 'SHEET_RANGE_THEME_MODEL_PLUGIN', data: '{}' },
  ],
}

export const reqData: IReq<Array<IFormDataIntervalDto>> = {
  errorCode: 200,
  topMessage: '',
  data: [
    {
      storage: '141917',
      id: '26f701f0-3699-405c-96a9-11781cae660b',
      temId: 'f5d2b156-e62f-4051-a9dc-4d389a25954a',
      formId: '2ec64363-b286-4950-9d8a-5fb405a07b1c',
      formName: '静配中心 成品输液质量检查表',
      formData:
        '{"date":"2025-01-01","timeSlot":"am","fridgeId":"001","temperature":"28","signature":"43"}',
      remark: '',
      enabled: true,
      createUser: '0646',
      createUserName: '董瑞祥',
      createTime: '2025-03-18 09:35:27',
      lastUpdateTime: '2025-03-18 09:35:27',
      lastUpdateUser: '管理员',
      isTimeOut: false,
      isValidFail: false,
      state: 1,
      stateName: '未审核',
      scheduleId: null,
    },
    {
      storage: '141917',
      id: '06107bec-62ba-467a-b38c-a3f5fe8ad112',
      temId: 'f5d2b156-e62f-4051-a9dc-4d389a25954a',
      formId: '2ec64363-b286-4950-9d8a-5fb405a07b1c',
      formName: '静配中心 成品输液质量检查表',
      formData:
        '{"date":"2025-01-01","timeSlot":"pm","fridgeId":"001","temperature":"33","signature":"44"}',
      remark: '',
      enabled: true,
      createUser: 'admin',
      createUserName: '管理员',
      createTime: '2024-11-25 13:30:33',
      lastUpdateTime: '2025-03-18 09:35:27',
      lastUpdateUser: '管理员',
      isTimeOut: false,
      isValidFail: false,
      state: 1,
      stateName: '未审核',
      scheduleId: null,
    },
    {
      storage: '141917',
      id: '06107bec-62ba-467a-b38c-a3f5fe8ad112',
      temId: 'f5d2b156-e62f-4051-a9dc-4d389a25954a',
      formId: '2ec64363-b286-4950-9d8a-5fb405a07b1c',
      formName: '静配中心 成品输液质量检查表',
      formData:
        '{"date":"2025-01-02","timeSlot":"am","fridgeId":"001","temperature":"26","signature":"30"}',
      remark: '',
      enabled: true,
      createUser: 'admin',
      createUserName: '管理员',
      createTime: '2024-11-25 13:30:33',
      lastUpdateTime: '2025-03-18 09:35:27',
      lastUpdateUser: '管理员',
      isTimeOut: false,
      isValidFail: false,
      state: 1,
      stateName: '未审核',
      scheduleId: null,
    },
    {
      storage: '141917',
      id: '06107bec-62ba-467a-b38c-a3f5fe8ad112',
      temId: 'f5d2b156-e62f-4051-a9dc-4d389a25954a',
      formId: '2ec64363-b286-4950-9d8a-5fb405a07b1c',
      formName: '静配中心 成品输液质量检查表',
      formData:
        '{"date":"2025-01-02","timeSlot":"pm","fridgeId":"001","temperature":"22","signature":"40"}',
      remark: '',
      enabled: true,
      createUser: 'admin',
      createUserName: '管理员',
      createTime: '2024-11-25 13:30:33',
      lastUpdateTime: '2025-03-18 09:35:27',
      lastUpdateUser: '管理员',
      isTimeOut: false,
      isValidFail: false,
      state: 1,
      stateName: '未审核',
      scheduleId: null,
    },
  ],
}
